home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 369 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.6 KB

  1. From: kanze@gabi.gabi-soft.fr (J. Kanze)
  2. Message-ID: <KANZE.96Feb9161600@gabi.gabi-soft.fr>
  3. X-Original-Date: 09 Feb 1996 15:16:00 GMT
  4. Path: in1.uu.net!bounce-back
  5. Date: 09 Feb 96 15:43:22 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Newsgroups: comp.std.c++
  8. Subject: Re: Give operator. a chance
  9. Organization: GABI Software, Sarl.
  10. References: <311535F1.562A@et.se>
  11. In-Reply-To: Dan Holmsand's message of 05 Feb 96 04:00:46 GMT
  12. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  13.     iQBFAgUBMRtrpuEDnX0m9pzZAQH0uQF9H0zDjldcwpS2mEsNcJNT6P+XaNvHhAl1
  14.     z9PhJhSa112VM2Erz5A1VFSAl5EDU9o6
  15.     =bGak
  16.  
  17. In article <311535F1.562A@et.se> Dan Holmsand <dan@et.se> writes:
  18.  
  19. > > Dan Holmsand <dan@et.se> writes:
  20. > > >Is operator.() banned from the standards discussion?
  21. > I'm really sorry for reopening this old wound, but many thanks anyway
  22. > for all the answers.
  23. > My reason for asking was my own "discovery" that the STL containers and
  24. > algorithms are clearly overrated - sure, they are very efficient indeed
  25. > for simple objects with trivial constructors. However, if you consider
  26. > a vector<vector<string> >, and insert a new element at the beginning of
  27. > the outer vector, the resulting code is clearly less than efficient
  28. > (copy constructing all the strings of all the vectors is everything
  29. > but efficient).
  30. > That's why I was hoping for smart references to come to the rescue when
  31. > needed, say by redefining the original vector as
  32. > vector<smart_ref<vector<string> > >, to gain the speed benefit of a
  33. > faster copy constructor, while not having to rewrite all the code
  34. > involved.
  35.  
  36. If this turns out to be important, there is nothing in the standard to
  37. prevent the vector class from implementing copy and assignment using
  38. copy on write, exactly as will probably happen in most implementations
  39. of string (where copy and assignment *are* expected to be frequent
  40. operations).
  41.  
  42. I would suggest, however, that in the above case, you are simply not
  43. using the appropriate container.  Perhaps what you need is a list<
  44. vector< string > >.  The whole purpose of having different types of
  45. containers is that each represents a distinct tradeoff.
  46. -- 
  47. James Kanze           (+33) 88 14 49 00          email: kanze@gabi-soft.fr
  48. GABI Software, Sarl., 8 rue des Francs Bourgeois, 67000 Strasbourg, France
  49. Conseils, itudes et rialisations en logiciel orienti objet --
  50.               -- A la recherche d'une activiti dans une region francophone
  51. ---
  52. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  53.   Contact address: std-c++-request@ncar.ucar.edu.  Moderation policy:
  54.   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html. ]
  55.